package cn.hairui.blog.service;

import cn.hairui.blog.dao.SRescMenuMapper;
import cn.hairui.blog.entity.SRescManage;
import cn.hairui.blog.entity.SRescMenu;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author laoganbu
 * @since 2020-04-08
 */
@Service
public class SRescMenuServiceImpl extends ServiceImpl<SRescMenuMapper, SRescMenu> implements SRescMenuService {

    @Autowired
    private SRescMenuMapper sRescMenuMapper;

    @Override
    public List<SRescMenu> selectByRescIdUseFlagOrder(String rescId, String flag) {
        return sRescMenuMapper.selectByRescIdUseFlagOrder(rescId, flag);
    }

    @Override
    public int countByRescId(String rescId) {
        QueryWrapper<SRescMenu> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("resc_id", rescId);
        return sRescMenuMapper.selectCount(queryWrapper);
    }

    @Override
    public List<Map> listMenu() {
        return sRescMenuMapper.listMenu();
    }

    @Override
    public List<SRescManage> listManage() {
        return sRescMenuMapper.listManage();
    }
}
